import cv2
import numpy as np

# author: 周张珉
# 边缘检测


class Edge:
    @staticmethod
    def edge_detector(img, sigma=0.33):
        val = np.median(img)
        lower = max(0, (1 - sigma) * val)
        upper = min(255, (1 + sigma) * val)
        return cv2.Canny(img, lower, upper)
